﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WISD.CarFriend.Web.Admin.Module.FriendLinkManage
{
    public partial class Add : Utility.BasicPage
    {
        #region 字段
        private WISD.CarFriend.BLL.Web.FriendLinkManageModule m_FLManageModuleBLL
            = new BLL.Web.FriendLinkManageModule();
        #endregion


        #region 事件
        /// <summary>
        /// 加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    // 验证权限
                    base.CheckPermission("FriendLinkManage_Add");
                }
            }
            catch (Exception exception)
            {
                base.ShowMessageBox(350, 230, "错误提示", "<b>出现错误啦！</b>" + exception.Message.ToString(), "back", "Error");
            }
        }


        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                this.Save();
            }
            catch (Exception exception)
            {
                base.ShowMessageBox(350, 230, "错误提示", "<b>出现错误啦！</b>" + exception.Message.ToString(), "back", "Error");
            }
        }
        #endregion


        #region 方法
        /// <summary>
        /// 保存
        /// </summary>
        private void Save()
        {
            this.m_FLManageModuleBLL.AddFriendLink(this.txtTitle.Text.Trim(),
                this.txtImagePath.Text.Trim(), base.AddHttp(this.txtURL.Text.Trim()), int.Parse(Session["UserID"].ToString()));
            base.ShowMessageBox("新增友情链接成功啦！", "", "Success");
        }
        #endregion
    }
}